package com.loong.kafka.java.producer;

import scala.collection.Iterator;
import scala.io.Source;

import java.io.*;

/**
 * Created by 梁浩峰 on 2016/9/10 18:18.
 */
public class LogDataSource {
    public static void main(String[] args) throws Exception {
        if (args!=null&&args.length>0){
            sendMsg(args[0]);
        }else {
            System.exit(1);
        }
    }

    private static void sendMsg(String filePath) throws Exception {
        File file = new File(filePath);
        BufferedReader reader = new BufferedReader(new FileReader(filePath));
        String len;
        while ((len=reader.readLine())!=null){
            System.out.println(len);
            Thread.sleep(30000);
            LogProducer producer = new LogProducer();
            producer.send("ws2",len);
        }
    }
}
